﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using DAL;

namespace FCTC_Web.Models
{
    public class SessionArrangement:EntityBase
    {
        [Display(Name = "开始时间"), Required()]
        public DateTime StartTime { get; set; }

        [Display(Name = "结束时间"), Required()]
        public DateTime EndTime { get; set; }

        [Display(Name = "日期"), Required()]
        public DateTime Day { get; set; }

        public int? LeftTeamID{get;set;}
        public virtual Team LeftTeam { get; set; }

        [Display(Name = "左队得分")]
        public int? LeftScore { get; set; }
        [Display(Name = "右队得分")]
        public int? RightScore { get; set; }

        public int? RightTeamID { get; set; }
        public virtual Team RightTeam { get; set; }

        public int? SessionUnitID;
        public virtual SessionUnit SessionUnit { get; set; }

        [Display(Name = "场地"),MaxLength(50)]
        public string Field { get; set; }

        [Display(Name = "场裁判"), MaxLength(50)]
        public string Referee { get; set; }

        public string GetScore()
        {
            return LeftScore.ToString() + ":" + RightScore.ToString();
        }

        public int? GetWinnerID()
        {
            return LeftScore > RightScore? LeftTeamID:RightTeamID;
        }

    }
}